package com.example.kick.java8;

import com.example.kick.bean.Player;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;

public class SortTest {

    public static void sortPlayers(List<Player> list) {
        list.sort(Comparator.comparing(Player::getAge).thenComparing(Player::getPlayerName).reversed());
        list.stream().forEach(p -> System.out.println(p.getPlayerName() + "," + p.getAge()));
    }

    public static void main(String[] args) {
        List<Player> list = Arrays.asList(new Player("Michael", 60), new Player("Kobe", 43),
                new Player("Magic", 65), new Player("Tracy", 43), new Player("Shark", 60));
        sortPlayers(list);


    }

}
